package com.starpl.mobile.android.monthunsae.november.domain;

import java.io.Serializable;

import org.json.JSONException;
import org.json.JSONObject;

import android.util.Log;

/**
 * 홈화면 키워드에서 사용하는 기본적인 형태의 키워드 데이터
 * 
 * @author 우연화
 * @since 2011.03.16
 */
public class Keyword implements Serializable
{
	private static final long serialVersionUID = 1L;
	private int mKeywordIdx;
	private String mKeywordName;
	private boolean mUseFlag;
	private String mImageURL;
	private int mNewPostCount;
	private int mPostCount;
	private int mMemberCount;
	
	/**
	 * 키워드 생성자
	 * 
	 * @param object JSONObejct(extData1.object(index))
	 */
	public Keyword(JSONObject object)
	{
		try
		{
			this.mKeywordIdx = object.getInt("keywordIdx");
			this.mKeywordName = object.getString("keywordName");
			this.mUseFlag = object.getBoolean("useFlag");
			
			if(!object.isNull("imageUrl"))
			{
				this.mImageURL = object.getString("imageUrl");
			}
			
			if(!object.isNull("newPostCount"))
			{
				this.mNewPostCount = object.getInt("newPostCount");
			}
			
			if(!object.isNull("postCount"))
			{
				this.mPostCount = object.getInt("postCount");
			}
			
			if(!object.isNull("memberCount"))
			{
				this.mMemberCount = object.getInt("memberCount");		
			}
		}
		catch(JSONException e)
		{
			Log.e("Keyword", "Keyword 생성자, JSON 파싱 중 에러가 발생하였습니다.");
		}
	}

	public int getKeywordIdx()
	{
		return mKeywordIdx;
	}

	public void setKeywordIdx(int keywordIdx)
	{
		this.mKeywordIdx = keywordIdx;
	}

	public String getKeywordName()
	{
		return mKeywordName;
	}

	public void setKeywordName(String keywordName)
	{
		this.mKeywordName = keywordName;
	}

	public boolean isUseFlag()
	{
		return mUseFlag;
	}

	public void setUseFlag(boolean useFlag)
	{
		this.mUseFlag = useFlag;
	}

	public String getImageURL()
	{
		return mImageURL;
	}

	public void setImageURL(String imageURL)
	{
		this.mImageURL = imageURL;
	}

	public int getNewPostCount()
	{
		return mNewPostCount;
	}

	public void setNewPostCount(int newPostCount)
	{
		this.mNewPostCount = newPostCount;
	}

	public int getPostCount()
	{
		return mPostCount;
	}

	public void setPostCount(int postCount)
	{
		this.mPostCount = postCount;
	}

	public int getMemberCount()
	{
		return mMemberCount;
	}

	public void setMemberCount(int memberCount)
	{
		this.mMemberCount = memberCount;
	}
}
